/*************************************************************************
	> File Name: oj-376_machine_translate.cpp
	> Author: Wang Bo
	> Mail: 1276106221@qq.com
	> Created Time: 2020年11月04日 星期三 15时40分01秒
 ************************************************************************/

#include <iostream>
#include <deque>
using namespace std;

bool search_deque(deque<int>::iterator it_begin, deque<int>::iterator it_end, int val) {
    auto it = it_begin;
    while (it != it_end) {
        if (*it == val) return true;
        it++;
    }
    return false;
}

int main() {
    int m = 0, n = 0, word;
    int search_cnt = 0;
    cin >> m >> n;
    deque<int> mymem;
    for (int i = 0; i < n; ++i) {
        cin >> word;
        if (search_deque(mymem.begin(), mymem.end(), word)) continue;
        else mymem.push_back(word), search_cnt++;
        if (mymem.size() > m) mymem.pop_front();
    }
    cout << search_cnt;
    return 0;
}
